package com.woniu.new_orange.customization_model_zhang.controller;

import com.woniu.new_orange.customization_model_zhang.service.BulletTrainService;
import com.woniu.new_orange.customization_model_zhang.service.CarService;
import com.woniu.new_orange.customization_model_zhang.vo.BulletTrainVo;
import com.woniu.new_orange.customization_model_zhang.vo.CarVo;
import com.woniu.new_orange.entity.BulletTrain;
import com.woniu.new_orange.entity.Car;
import com.woniu.new_orange.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Program: new_orange->BulletTrainConfig
 * @Description:
 * @Author: PC
 * @Date: 2023-02-07 20:23
 * @Version： 1.0
 **/
@RestController
@RequestMapping("/car")
public class CarConfig {
    @Resource
    private CarService carService;

    @PutMapping("/submitFormCarDo")
    public Result add(@RequestBody Car car){
        int insert = carService.insertSelective(car);
        return Result.ok();
    }

    @GetMapping("{airTicketBy1}")
    public Result loadTrain(@PathVariable String airTicketBy1){
        int i = Integer.parseInt(airTicketBy1);
        List<CarVo> carVos = carService.selectAll(i);
        return Result.ok().data("AirData",carVos);
    }
}
